﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class ePioneer_ep_real_index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            GetRealList();
    }

    /// <summary>
    /// 绑定最高和最新战法
    /// </summary>
    public void GetRealList()
    {
        string cmsService = System.Configuration.ConfigurationManager.ConnectionStrings["CMSService"].ToString();
        cmsService += "ep_real.ashx?action=GetAllRealList";
        List<ePioneer_Real> listf = UrlGet.GetObject<List<ePioneer_Real>>(cmsService);

        //最高战法
        StringBuilder sbhReturn = new StringBuilder();
        List<ePioneer_Real> hlist = listf.OrderByDescending(p => p.Average).Take(8).ToList();
        int hCount = 0;
        foreach (var n in hlist)
        {
            hCount++;
            if (hCount < 4)
            {
                sbhReturn.AppendLine(" <div class=\"ltm\" style=\"height:23px;\"><span class=\"cred\">" + hCount + ".&nbsp;&nbsp;</span><a href='ep_real.aspx?id=" + n.ID + "'>" + n.Name + "</a></div>");
            }
            else
            {
                sbhReturn.AppendLine(" <div class=\"ltm\" style=\"height:23px;\"><span class=\"cnor\">" + hCount + ".&nbsp;&nbsp;</span><a href='ep_real.aspx?id=" + n.ID + "'>" + n.Name + "</a></div>");
            }
        }
        high_list.InnerHtml = sbhReturn.ToString();


        //最新战法
        StringBuilder sbnReturn = new StringBuilder();
        int nCount = 0;
        List<ePioneer_Real> nlist = listf.OrderByDescending(p => p.ID).Take(6).ToList();
        foreach (var n in nlist)
        {
            nCount++;
            if (nCount < 4)
            {
                sbnReturn.AppendLine(" <div class=\"ltm\" style=\"height:23px;\"><span class=\"cred\">" + nCount + ".&nbsp;&nbsp;</span><a href='ep_real.aspx?id=" + n.ID + "'>" + n.Name + "</a></div>");
            }
            else
            {
                sbnReturn.AppendLine(" <div class=\"ltm\" style=\"height:23px;\"><span class=\"cnor\">" + nCount + ".&nbsp;&nbsp;</span><a href='ep_real.aspx?id=" + n.ID + "'>" + n.Name + "</a></div>");
            }
        }
        new_list.InnerHtml = sbnReturn.ToString();
    }
}